using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class PlayerStatBar : MonoBehaviour
{
    public float maxHealth = 5;
    public float currentHealth;
    public Sprite fullHeart;
    public Sprite emptyHeart;
    public Image[] hearts;

    private void Update()
    {
        for (int i = 0; i < hearts.Length; i++)
        {
            hearts[i].sprite = i < currentHealth ? fullHeart : emptyHeart;
        }
    }

    public void OnHealthChange(float current)
    {
        currentHealth = current;
    }
}